<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>
        <title>Nuevo usuario</title>
    </h:head>
    <h:body style="background-color: #ffffcc">
        <h:graphicImage library="images" name="logo.png"/>
        <hr/>
        <p:messages/>
        <hr/>
        <h:form>
            <p:panel header="Registro:">
                <h:panelGrid columns="3">
                    <h:outputLabel for="username" value="Usuario: "/>
                    <p:inputText id="username" value="#{registroController.usuario.nick}" maxlength="20" size="20" required="true" requiredMessage="Usuario requerido"/>
                    <p:message for="username"/>
                    <h:outputLabel for="password1" value="Contraseña: "/>
                    <p:password id="password1" value="#{registroController.usuario.password}" feedback="true" minLength="8" maxlength="20" size="20" required="true" requiredMessage="Contraseña requerida" validatorMessage="Debe tener 8 o más caracteres">
                        <f:validateLength minimum="8"/>
                    </p:password>
                    <p:message for="password1"/>
                    <h:outputLabel for="password2" value="Confirmar contraseña: "/>
                    <p:password id="password2" value="#{registroController.password2}" feedback="false" minLength="8" maxlength="20" size="20" required="true" requiredMessage="Debes confirmar la contraseña" validatorMessage="Debe tener 8 o más caracteres">
                        <f:validateLength minimum="8"/>
                    </p:password>
                    <p:message for="password2"/>
                    <h:outputLabel for="email" value="E-mail: "/>
                    <p:inputText id="email" value="#{registroController.usuario.email}" maxlength="100" size="20" required="true" requiredMessage="E-mail requerido"/>
                    <p:message for="email"/>
                </h:panelGrid>
                <f:facet name="footer">
                    <h:commandButton value="Aceptar" action="#{registroController.doRegistrar()}"/>
                </f:facet>
            </p:panel>
        </h:form>
    </h:body>
</html>
